package main;

import javax.media.jai.PlanarImage;
import javax.media.jai.operator.MedianFilterDescriptor;
import javax.media.jai.operator.MedianFilterShape;

import ourFilter.OurSink;
import ourFilter.OurSource;
import ourFilter.ProcessFilter;
import pipe.Pipe;
import processors.CentroidProcessor;
import processors.DilationProcessor;
import processors.ErodeProcessor;
import processors.MedianProcessor;
import processors.ROIProcessor;
import processors.ThresholdProcessor;
import processors.XORProcessor;
import filter.Sink;
import filter.Source;

public class TestTreiber {

	public static void main(String[] args) {
		Pipe<PlanarImage> p1 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p2 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p3 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p4 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p5 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p6 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p7 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p8 = new Pipe<PlanarImage>();
		Pipe<PlanarImage> p9 = new Pipe<PlanarImage>();

		

		
		Source<PlanarImage> src = new OurSource<PlanarImage>("loetstellen.jpg", p1);
		
		new ProcessFilter(p1, p2, new ROIProcessor(), false, true);
		new ProcessFilter(p2, p3, new ThresholdProcessor(0, 50, 255), false, true);
		new ProcessFilter(p3, p4, new MedianProcessor(), false, true);
		new ProcessFilter(p4, p5, new ErodeProcessor(),false, true);
		new ProcessFilter(p5, p6, new DilationProcessor(),true, true);
		new ProcessFilter(p6, p7, new ThresholdProcessor(0, 230, 0), true, true);
		new ProcessFilter(p7, p8, new XORProcessor("ThresholdProcessor.jpg"),false, true);
		new ProcessFilter(p8, p9, new CentroidProcessor(), false, true);
		
		Sink<PlanarImage> sink = new OurSink(p9);
		
		sink.run(); //pull-pipe
		//src.run(); //push-pipe

	}

}
